/* 
 * File:   CalendarRenderer.h
 * Author: Muqtafi Akhmad
 */
#include "../Utilities/boolean.h"
#include "../ADTFile/File.h"
#include "../ADTDate/Date.h"
#include "../ADTPriorityList/PriorityList.h"
#include "../ADTEvent/Event.h"
#include "../ADTDateTime/DateTime.h"
#include "../ADTCalendar/Calendar.h"
#include <stdio.h>
#include <stdlib.h>
#ifdef _WIN32
#include <conio.h>
#endif
#ifndef CALENDAR_RENDERER_H
#define CALENDAR_RENDERER_H
#define DAY_IN_WEEK_MAX 7
#define WEEK_IN_MONTH_MAX 6
#define H_STRIP '-'
#define H_CELL "-------"
#define V_STRIP '|'
#define LEFT_KEY 97
#define RIGHT_KEY 100
#define ESC_KEY 27

/**
 * Definition of CalendarRenderer to display Events in a month
 */
typedef struct {
    Calendar *calendar; // reference to calendar 
    int currentMonth; // the current rendered month
    int currentYear; // the current rendered year
} CalendarRenderer;
/**
 * Creates a calendar renderer
 * @param calendar referenced calendar 
 * @return calendar renderer
 */
CalendarRenderer CreateCalendarRenderer(Calendar *calendar);
/**
 * Returs reference to calendar
 * @param renderer calendar renderer
 * @return reference to calendar
 */
Calendar * GetCalendar(CalendarRenderer renderer);
/**
 * Returns current month of renderer
 * @param renderer renderer
 * @return current month
 */
int GetCurrentMonth(CalendarRenderer renderer);
/**
 * Returns current year of renderer
 * @param renderer renderer
 * @return current year
 */
int GetCurrentYear(CalendarRenderer renderer);
/**
 * Set calendar of renderer
 * @param renderer renderer
 * @param calendar calendar
 */
void SetCalendar(CalendarRenderer* renderer, Calendar *calendar);
/**
 * Set current month of renderer
 * @param renderer renderer
 * @param month current month
 */
void SetCurrentMonth(CalendarRenderer *renderer, int month);
/**
 * Set current year of renderer
 * @param renderer renderer
 * @param year current year
 */
void SetCurrentYear(CalendarRenderer *renderer, int year);
/**
 * Move current month to next month
 * @param renderer renderer
 */
void AdvanceMonth(CalendarRenderer *renderer);
/**
 * Move current month to previous month
 * @param renderer
 */
void BackMonth(CalendarRenderer *renderer);
/**
 * Render the calendar for the current month and year
 * @param renderer
 */
void RenderCalendar(CalendarRenderer renderer);
/**
 * Print end line
 */
void EndLine();
/**
 * Print horizontal line
 */
void PrintHLine();
/**
 * Show events count in a month as table
 * @param calendar the calendar
 * @param args year and month of calendar
 */
void ShowCalendar(Calendar* calendar, char**args);
#endif

